public class test {
    class Solution {
        public int lengthOfLongestSubstring(String s) {
            char[] ss = s.toCharArray();
            int[] hash = new int[128];
            int left = 0;
            int right = 0;
            int len = s.length();
            int ret = 0;
            while(right < len){
                hash[ss[right]] ++;
                while(hash[ss[right]] > 1) {
                    hash[ss[left++]] --;
                }
                ret = Math.max(ret,right-left+1);
                right ++;
            }
            return ret;
        }
    }
}
